Zepto(function(){
	/*setTimeout(function () {
        $('#loading').hide();
    }, 500);

    $("body").animate({
        'opacity':1,
    },500);
    
    $("#back").on("click",function(){
        history.go(-1);
    })*/
	//症状
	var symptom = $("#examination_symptom").val();
	var symptomArray = symptom.split(",");
	$(".symptom").each(function(index) {
		var symptomValue = $(this).attr("value");
		for(var i = 0; i < symptomArray.length; i++) {
			if(symptomArray[i] == symptomValue) {
				$(this).attr("checked","checked");
				break;
			}
		}
		
	});
	
	
	//血压左侧
	var leftBloodPressure = $("#leftBloodPressure").val();
	var leftBloodPressureArray = leftBloodPressure.split(",");
	$(".leftBloodPressure").each(function(index) {	
				$(this).text(leftBloodPressureArray[index] );
		
	});
	
	//血压右侧
	var rightBloodPressure = $("#rightBloodPressure").val();
	var rightBloodPressureArray = rightBloodPressure.split(",");
	$(".rightBloodPressure").each(function(index) {	
				$(this).text(rightBloodPressureArray[index]);
	});
	
	//饮食习惯
	var foodhabit = $("#foodhabit").val();
	var foodhabitArray = foodhabit.split(",");
	var foodStr = "";
	for(var i = 0; i < foodhabitArray.length; i++) {
		if(foodhabitArray[i]!="" && foodhabitArray[i]!=null) {
			if(foodhabitArray[i] == 1) {
				foodStr+="荤素均衡,";
			}else if(foodhabitArray[i] == 2) {
				foodStr+="荤食为主,";
			}else if(foodhabitArray[i] == 3) {
				foodStr+="素食为主,";
			}else if(foodhabitArray[i] == 4) {
				foodStr+="嗜盐,";
			}else if(foodhabitArray[i]==5) {
				foodStr+="嗜油,";
			}else if(foodhabitArray[i] == 6) {
				foodStr+="嗜糖,";
			}
		}
	}
	if(foodStr!=null && foodStr!='') {
		if (foodStr.substring(foodStr.length-1, foodStr.length) == ",") {
			foodStr=foodStr.substring(0, foodStr.length-1);
		} 
		$("#span_foodhabit").text(foodStr);
	}
	
	//空腹血糖
	var fbg = $("#fbg").val();
	var fbgArray = fbg.split(",");
	$(".fbg").each(function(index) {	
		$(this).text(fbgArray[index]);
		
	});
	
	
	//脑血管疾病
	var cerebrovascularDisease = $("#cerebrovascularDisease").val();
	var cerebrovascularDiseaseStr = "";
	var cerebrovascularDiseaseArray = cerebrovascularDisease.split(",");
	for(var i = 0; i < cerebrovascularDiseaseArray.length; i++) {
		if(cerebrovascularDiseaseArray[i] == 1 ) {
			cerebrovascularDiseaseStr+="未发现,";
		}else if(cerebrovascularDiseaseArray[i] == 2) {
			cerebrovascularDiseaseStr+="缺血性卒中,";
		}else if(cerebrovascularDiseaseArray[i] == 3) {
			cerebrovascularDiseaseStr+="脑出血,";
		}else if(cerebrovascularDiseaseArray[i] == 4) {
			cerebrovascularDiseaseStr+="蛛网膜下腔出血,";
		}else if(cerebrovascularDiseaseArray[i] == 5) {
			cerebrovascularDiseaseStr+="短暂性脑缺血发作,";
		}else if(cerebrovascularDiseaseArray[i] == 6) {
			cerebrovascularDiseaseStr+="其他,";
		}
		
	}
	
	if(cerebrovascularDiseaseStr!="" && cerebrovascularDiseaseStr!=null) {
		if (cerebrovascularDiseaseStr.substring(cerebrovascularDiseaseStr.length-1, cerebrovascularDiseaseStr.length) == ",") {
			cerebrovascularDiseaseStr= cerebrovascularDiseaseStr.substring(0, cerebrovascularDiseaseStr.length-1);
		} 
		$("#span_cerebrovascularDisease").text(cerebrovascularDiseaseStr);
	}
	
	//肾脏疾病
	var nephropathy = $("#nephropathy").val();
	var nephropathyStr = "";
	var nephropathyArray = nephropathy.split(",");
		for(var i = 0; i < nephropathyArray.length; i++) {
			if(nephropathyArray[i] == 1) {
				nephropathyStr+="未发现,";
			}else if(nephropathyArray[i] == 2) {
				nephropathyStr+="糖尿病肾病,";
			}else if(nephropathyArray[i] == 3) {
				nephropathyStr+="肾功能衰竭,";
			}else if(nephropathyArray[i] == 4) {
				nephropathyStr+="急性肾炎,";
			}else if(nephropathyArray[i] == 5) {
				nephropathyStr+="慢性肾炎,";
			}else if(nephropathyArray[i] == 6) {
				nephropathyStr+="其他,";
			}
		}
		
	if(nephropathyStr!="" && nephropathyStr!=null) {
		if (nephropathyStr.substring(nephropathyStr.length-1, nephropathyStr.length) == ",") {
			nephropathyStr=nephropathyStr.substring(0,nephropathyStr.length-1);
		} 
		$("#span_nephropathy").text(nephropathyStr);
	}
	
	//心脏疾病
	var heartDisease = $("#heartDisease").val();
	var heartDiseaseStr = "";
	var heartDiseaseArray = heartDisease.split(",");
		
		for(var i = 0; i < heartDiseaseArray.length; i++) {
			if(heartDiseaseArray[i] == 1) {
				heartDiseaseStr+="未发现,";
			}else if(heartDiseaseArray[i] == 2) {
				heartDiseaseStr+="心肌梗死,";
			}else if(heartDiseaseArray[i] == 3) {
				heartDiseaseStr+="心绞痛,";
			}else if(heartDiseaseArray[i] == 4) {
				heartDiseaseStr+="冠状动脉血运重建,";
			}else if(heartDiseaseArray[i] == 5) {
				heartDiseaseStr+="充血性心力衰竭,";
			}else if(heartDiseaseArray[i] == 6) {
				heartDiseaseStr+="心前区疼痛,";
			}else if(heartDiseaseArray[i] == 7) {
				heartDiseaseStr+="其他,";
			}
		}
		
		if(heartDiseaseStr!=null && heartDiseaseStr!="") {
			if (heartDiseaseStr.substring(heartDiseaseStr.length-1, heartDiseaseStr.length) == ",") {
				heartDiseaseStr=heartDiseaseStr.substring(0,heartDiseaseStr.length-1);
			} 
			$("#span_heartDisease").text(heartDiseaseStr);
		}
	
		//血管疾病
		var vascularDisease = $("#vascularDisease").val();
		var vascularDiseaseArray = vascularDisease.split(",");
		var vascularDiseaseStr = "";
			for(var i = 0; i < vascularDiseaseArray.length; i++) {
				if(vascularDiseaseArray[i] == 1) {
					vascularDiseaseStr+="未发现,";
				}else if(vascularDiseaseArray[i] == 2) {
					vascularDiseaseStr+="夹层动脉瘤,";
				}else if(vascularDiseaseArray[i] == 3) {
					vascularDiseaseStr+="动脉闭塞性疾病,";
				}else if(vascularDiseaseArray[i] == 4) {
					vascularDiseaseStr+="其他,";
				}
			}
			
			if(vascularDiseaseStr!=null && vascularDiseaseStr!="") {
				if (vascularDiseaseStr.substring(vascularDiseaseStr.length-1, vascularDiseaseStr.length) == ",") {
					vascularDiseaseStr=vascularDiseaseStr.substring(0, vascularDiseaseStr.length-1);
				} 
				$("#span_vascularDisease").text(vascularDiseaseStr);
			}
			
			//眼部疾病
			var eyeDisease = $("#eyeDisease").val();
			var eyeDiseaseArray = eyeDisease.split(",");
			var eyeDiseaseStr = "";
				for(var i = 0; i < eyeDiseaseArray.length; i++) {
					if(eyeDiseaseArray[i] == 1) {
						eyeDiseaseStr+="未发现,";
					}else if(eyeDiseaseArray[i] == 2) {
						eyeDiseaseStr+="视网膜出血或渗出,";
					}else if(eyeDiseaseArray[i] == 3) {
						eyeDiseaseStr+="视乳头水肿,";
					}else if(eyeDiseaseArray[i] == 4) {
						eyeDiseaseStr+="白内障,";
					}else if(eyeDiseaseArray[i] == 5) {
						eyeDiseaseStr+="其他,";
					}
				}
				
			if(eyeDiseaseStr!=null && eyeDiseaseStr!="") {
				if (eyeDiseaseStr.substring(eyeDiseaseStr.length-1, eyeDiseaseStr.length) == ",") {
					eyeDiseaseStr=eyeDiseaseStr.substring(0,eyeDiseaseStr.length-1);
				} 
				$("#span_eyeDisease").text(eyeDiseaseStr);
			}
			
	
			//初始化
			//异常
			var exception = $("#healthException").val();
			var exceptionArray = exception.split(",");
			$(".exception").each(function(index) {	
						$(this).text(exceptionArray[index] );
				
			});
	
			//健康指导意见
			var healthGuidelines = $("#healthGuidelines").val();
			var healthGuidelinesArray = healthGuidelines.split(",");
			$(".guidelines").each(function(index) {
				var healthGuidelinesValue = $(this).attr("value");
				
				for(var i = 0; i < healthGuidelinesArray.length; i++) {
					if(healthGuidelinesArray[i] == healthGuidelinesValue) {
						$(this).attr("checked","checked");
						break;
					}
				}
				
			});
			
			//危险因素控制text框回显
			var riskControlDesc = $("#riskControlDesc").val();
			var riskControlDescArray = riskControlDesc.split(",");
			$(".riskControlDesc").each(function(index) {
				 $(this).text(riskControlDescArray[index]);	
			});
	
			var riskControl = $("#riskControl").val();
			var riskControlArry = riskControl.split(",");
			$(".risk").each(function(index) {
				var riskControlValue = $(this).attr("value");
				for(var i = 0; i < riskControlArry.length; i++) {
					if(riskControlArry[i] == riskControlValue) {
						$(this).attr("checked","checked");
						break;
					}
				}
				
			});
	
			//住院史时间
			var inOutHosipitalDate = $("#inOutHosipitalDate1").val();
			var inOutHosipitalDateArray = inOutHosipitalDate.split(",");
			$("#in1").text(inOutHosipitalDateArray[0]);
			$("#out1").text(inOutHosipitalDateArray[1]);
			var inOutHosipitalDate = $("#inOutHosipitalDate2").val();
			var inOutHosipitalDateArray = inOutHosipitalDate.split(",");
			$("#in2").text(inOutHosipitalDateArray[0]);
			$("#out2").text(inOutHosipitalDateArray[1]);
	
	
});